var remote ="http://218.17.253.18:22225/bee";
var remote_hk="http://223.255.242.74:22225/bee";
var addr=remote; //初始地址

//var remoteAdd ="http://localhost:8080/BEE";
$(".route").change(function(){
    var routeType =$("input[name='route']:checked").val();
    addr=routeType==1?remote_hk:remote; // if select Hk Add

    $(".reg a").attr("href",addr+"/base/regist.jsp");
    $(".login a").attr("href",addr);
    $(".regtxt a:eq(0)").attr("href",addr+"base/regist.jsp");
    $(".otherlogiin a:eq(0)").attr("href",addr);
    $("#alipayapi").attr("href",addr.substr(0,addr.length-3)+"zfb/alipayapi.jsp");
});
$("#submit").click(function(){
    if($("#username").val()=="" || $("#passwd").val()==""){
        alert("请输入用户名或密码");
        return false;
    }
    $.ajax({
        url:addr+"/customer!customerLoginJsonp.action",
        cache: false,
        data:$('#msdform').serialize(),
        dataType : 'jsonp',
        jsonp: "callbackparam",//服务端用于接收callback调用的function名的参数
        jsonpCallback:"success_jsonpCallback",//callback的function名称
        success: function (result) {
            var data= result.result;
            if(data == "no"){
                alert("用户名或密码不存在");
            }else if(data == "index"){
                window.open(addr+"/index.jsp","_top");
            }else if(data == "token"){
                window.location.href=addr+"/error/tokenerror.jsp";
            }
        }
    });
    return false;
});
